home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.plaf.basic;
-
- import java.awt.Color;
- import java.awt.Font;
- import java.beans.PropertyChangeEvent;
- import javax.swing.JComponent;
- import javax.swing.JEditorPane;
- import javax.swing.plaf.ComponentUI;
- import javax.swing.text.EditorKit;
- import javax.swing.text.JTextComponent;
- import javax.swing.text.Style;
- import javax.swing.text.StyleConstants;
- import javax.swing.text.StyledDocument;
-
- public class BasicTextPaneUI extends BasicEditorPaneUI {
- public static ComponentUI createUI(JComponent var0) {
- return new BasicTextPaneUI();
- }
-
- public EditorKit getEditorKit(JTextComponent var1) {
- JEditorPane var2 = (JEditorPane)((BasicTextUI)this).getComponent();
- return var2.getEditorKit();
- }
-
- protected String getPropertyPrefix() {
- return "TextPane";
- }
-
- protected void propertyChange(PropertyChangeEvent var1) {
- super.propertyChange(var1);
- StyledDocument var2 = (StyledDocument)((BasicTextUI)this).getComponent().getDocument();
- Style var3 = var2.getStyle("default");
- if (var3 != null) {
- String var4 = var1.getPropertyName();
- if (var4.equals("foreground")) {
- Color var5 = (Color)var1.getNewValue();
- if (var5 != null) {
- StyleConstants.setForeground(var3, var5);
- } else {
- var3.removeAttribute(StyleConstants.Foreground);
- }
- } else if (var4.equals("font")) {
- Font var6 = (Font)var1.getNewValue();
- if (var6 != null) {
- StyleConstants.setFontFamily(var3, var6.getName());
- StyleConstants.setFontSize(var3, var6.getSize());
- StyleConstants.setBold(var3, var6.isBold());
- StyleConstants.setItalic(var3, var6.isItalic());
- } else {
- var3.removeAttribute(StyleConstants.FontFamily);
- var3.removeAttribute(StyleConstants.FontSize);
- var3.removeAttribute(StyleConstants.Bold);
- var3.removeAttribute(StyleConstants.Italic);
- }
- }
-
- }
- }
- }
-